<?php


namespace App\Model;


class User extends Model
{
    protected ?string $table = 'users';
    protected array $fillable = ['name','email','password','role'];

    /**
     * 与文章表关联
     * @return \Hyperf\Database\Model\Relations\HasMany
     */
    public function article()
    {
        return $this->hasMany(\App\Model\Articles::class, 'user_id', 'id');
    }

    /**
     * 与用户资料表关联
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function profiles()
    {
        return $this->hasOne(\App\Model\UserProfiles::class, 'user_id', 'id');
    }
}